<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html>
<head>
<%@ include file="../../commons/headfiles-jquery.jsp" %>
<link href="${base}css/apps/report/show.css" media="all" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
   var operation='add';
   
</script>
</head>
<body>
<div class="navbar navbar-fixed-top navbar-inverse">
		<div class="navbar-inner">
			<div class="container-fluid">
				<div class="nav-collapse">
					<a class="brand" href="#">自制半成品月报表</a>
					<button id="saveBtn" type="button" class="btn btn-primary" >
						保存
					</button>
					<button id="showbtn" type="button" class="btn btn-warning"
					  onclick="showAddDialog()"
					 >添加产品</button>            
									
					<c:if test="${ not empty bean.id }">
						<div class="btn-group">
							<button id="rbtn" class="btn btn-info" type="button">科研产品</button>
							<button class="btn dropdown-toggle btn-info" data-toggle="dropdown">
								<span class="caret"></span>
							</button>
							<ul class="dropdown-menu">
							   <li><a href="javascript:;">清除模式<input type="checkbox" id="clearbtn" value="true" onclick="setCleanModel(this);" /></a></li>	
							</ul>
						</div>						
					</c:if>
					<button type="button" class="btn" onclick="test()">测试</button>
					<div class="pull-right">
						<button class="btn btn-danger" type="button" onclick="closeMe();">
							<i class="icon-remove-sign"></i>关闭
						</button>
					</div>
				</div>
			</div>
		</div>
	</div>

<form id="armform">
<c:if test="${not empty bean.id}">
	<input type="hidden" id="bean.id" name="bean.id" value="${bean.id}" />
    <script type="text/javascript">
           operation="update";
       </script>
</c:if>
	<table  class="table table-bordered table-hover">
		<caption>
			<fmt:formatDate value="${bean.createDate.time}"
				pattern="yyyy年MM月dd日 " />自制半成品结存月报
		</caption>
		<thead>		 
			
			<tr>
				<th  rowspan="2" >
					代码
				</th>
				<th rowspan="2" >
					名称
				</th>
											
				
				<th colspan="2" >
					本月收入
				</th>
				<th colspan="2" >
					本月发出
				</th>
				
				<th colspan="2" >
					废品
				</th>
				<th colspan="2" >
					盈亏
				</th>
				<th>
					期末数
				</th>
				<th rowspan="2" >
					备注
				</th>
				
				<th rowspan="2" >删</th>
			</tr>
			<tr>			
			
				<th>
					当月
				</th>
				<th>
					累计
				</th>
				<th>
					当月
				</th>
				<th >
					累计
				</th>
				<th >
					当月
				</th>
				<th>
					累计
				</th>
				<th>
					当月
				</th>
				<th>
					累计
				</th>
				<th>
					待处理
				</th>							
			</tr>
			
		</thead>



		<tbody id="pdtBody">
			<c:forEach items="${bean.armItems}" var="aitem" varStatus="statu">
				<tr id='amp${statu.index}'>
					<td valign="bottom">
					   <input  type="text" class="code-field" 
					           name="bean.armItems[${statu.index}].host.code" value="${aitem.host.code}"/>

					</td>
					<!-- 从左往右依次为 -->
					<!-- 产品名称 -->
					<td valign="bottom">
					   <input  type="text" class="code-field" 
					   name="bean.armItems[${statu.index}].host.name" value="${aitem.host.name}"
					    readOnly
					   />
                     
					</td>
									
					<!-- 本期收入-->
					<td valign="bottom">
						<input type="text"
						    class="number-field"
							name="bean.armItems[${statu.index}].dataItems['Localin'].atomValue"
							value="${aitem.dataItems['Localin'].atomValue}" />

					</td>

					<td valign="bottom">
						${aitem.dataItems['Localin'].accumulateValue}
					</td>
					<!-- 本期发出 -->
					<td valign="bottom">
						<input type="text"
						 class="number-field"
							name="bean.armItems[${statu.index}].dataItems['Localout'].atomValue"
							value="${aitem.dataItems['Localout'].atomValue}" />

					</td>

					<td valign="bottom">
					${aitem.dataItems['Localout'].accumulateValue}
					</td>

					<!-- 废品  -->
					<td valign="bottom">
						<input type="text"
						 class="number-field"
							name="bean.armItems[${statu.index}].dataItems['Waster'].atomValue"
							value="${aitem.dataItems['Waster'].atomValue}" />
					</td>
					<td valign="bottom">
						${aitem.dataItems['Waster'].accumulateValue}

					</td>

					<!-- 盈亏 -->
					<td valign="bottom">
						<input type="text"
						 class="number-field"
							name="bean.armItems[${statu.index}].dataItems['Increment'].atomValue"
							value="${aitem.dataItems['Increment'].atomValue}" />
					</td>
					<td valign="bottom">
						${aitem.dataItems['Increment'].accumulateValue}
					</td>

					 <td valign="bottom">
						 <input type="text"
						  class="number-field"
							  name="bean.armItems[${statu.index}].dataItems['Willed'].atomValue"
							  value="${aitem.dataItems['Willed'].atomValue}" />
					 </td>					 
					<!-- 产品本月备注 -->
					<td valign="bottom">
						<input type="text" 
						    class="code-field"
							name="bean.armItems[${statu.index}].remark" value="${aitem.remark}" />
						
					</td>
                    <td valign="middle">
                         <img style="cursor: hand" src="${sbase}/images/removeme.gif"
							onclick="removeOne('${aitem.id}');" />
                    </td>

				</tr>
			</c:forEach>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="13">&copy;</td>
			</tr>					
		</tfoot>

	</table>
</form>

<script type="text/javascript">
	var lastrpt = '${bean.last.id}' || false;
	var rptId = '${bean.id}' || false;
	var itemIndex = '${fn:length(bean.armItems)}'||0;	
</script>
<script type="text/javascript" src="${base}scripts/apps/reporter/edit.js"></script>
<script type="text/javascript" src="${base}scripts/apps/reporter/semi/edit.js"></script>

<div id="debug"></div>
</body>
</html>